<template>
	<view>
		<div class="title-name">
			<slot name="title">歌单</slot>
		</div>
		<ul class="ablum-wraper">
			<li class="ablum-item" v-for="(item,index) in ablumArrayData" :key="index" @click="toAblumDetails(item)">
				<image :src="item.picUrl || item.coverImgUrl" mode="widthFix"></image>
				<p class="title">{{item.name}}</p>
				<div class="play-count">
					<span class="icon iconfont">&#xe600;</span>
					<span>{{item.playCount | transfromNumer}}</span>
				</div>
			</li>
		</ul>
	</view>
</template>

<script>
	import {
		mixinTransformNumerFilter

	} from "../utils/mixins.js"

	export default {
		data() {
			return {

			};
		},

		mixins: [mixinTransformNumerFilter],
		props: {
			ablumArrayData: {
				type: Array,
				default () {
					return []
				}
			}
		},
		methods: {
			toAblumDetails(item) {
				console.log(item.id)
				uni.navigateTo({
					url: `/pages/SongListDetails/SongListDetails?id=${item.id}`,
					animationType: 'pop-in',
					animationDuration: 2000
				})
			}
		},
	}
</script>

<style lang="scss">
	.title-name {
		font-size: .8rem;
		margin: 8px 0px;
		padding-left: 6px;
		border-left: 2px solid #ff3620;
	}
	.ablum-wraper {
		list-style: none;
		box-sizing: border-box;
		box-shadow: 0px 0px 3px gray;
		display: flex;
		flex-wrap: wrap;
		justify-content: left;
		.ablum-item {
			width: 32%;
			position: relative;
			margin: 2px;
			image {
				width: 100%;
			}

			.title {
				font-size: .6rem;
				text-overflow: -o-ellipsis-lastline;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				line-clamp: 2;
				-webkit-box-orient: vertical;
			}

			.play-count {
				position: absolute;
				font-size: .6rem;
				top: 5px;
				color: #EAFFEA;
				right: 5px;
				vertical-align: middle;

				.icon {
					font-size: .6rem;
				}
			}
		}
	}
</style>
